package com.ljkj.blockpay.ui.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;

import com.kongzue.baseokhttp.util.JsonMap;
import com.ljkj.blockpay.R;
import com.ljkj.blockpay.basedata.BaseActivity;
import com.ljkj.blockpay.databinding.ActivityRealNameAuthenticationBinding;
import com.ljkj.blockpay.presenter.RealNameAuthentPresenter;
import com.ljkj.blockpay.presenter.inter.RealAuthentInter;
import com.ljkj.blockpay.util.ToggleToActivity;
import com.ljkj.blockpay.widget.ClickListener;
import com.luck.picture.lib.tools.ToastUtils;

/**
 * 实名认证页面
 */
public class RealNameAuthenticationActivity extends BaseActivity<ActivityRealNameAuthenticationBinding, RealNameAuthentPresenter> implements RealAuthentInter.RealAuthentInterView,ClickListener {

    @Override
    public int initContentView() {
        return R.layout.activity_real_name_authentication;
    }

    @Override
    protected RealNameAuthentPresenter createPresenter() {
        return new RealNameAuthentPresenter(this,this);
    }

    @Override
    protected void init(Bundle savedInstanceState) {
        binding.setOnClick(this::onClick);
        binding.tvTitle.setLeftBackFinish(this);
    }

    @Override
    protected void initData() {
        super.initData();

        getPresenter().approvestatus();

    }

    @Override
    public void onClick(View view) {

        switch (view.getId()){
            case R.id.rl_primary:
                ToggleToActivity.toPrimaryauthentActivity(this);
                break;

            case R.id.rl_advanced:
                ToggleToActivity.toAdvancedActivity(this);
                break;
        }
    }

    //状态
    @Override
    public void statusSuccess(JsonMap jsonMap) {
        String primaryAuthStatus = jsonMap.getString("primaryAuthStatus");
        String seniorAuthStatus = jsonMap.getString("seniorAuthStatus");
        if (primaryAuthStatus.equals("0")){
            binding.ivIsfinished.setText("未认证");
        } else {
            binding.ivIsfinished.setText("已认证");
        }

        if (seniorAuthStatus.equals("0")){
            binding.ivIsfinish.setText("未认证");
        } else {
            binding.ivIsfinish.setText("已认证");
        }


    }

    @Override
    public void primarySuccess(JsonMap jsonMap) {

    }

    @Override
    public void seniorSuccess(JsonMap jsonMap) {

    }
}